<template>
  <div class="my-header" :style="{ color: color }">{{ title }}</div>
</template>

<script>
export default {
  props: {
    color:{
        type:String,
        default:'#fff'//如果父组件不传递color默认白色
    } ,
    title: {
      type: String, //传递类型必须是字符串否则会报错
      require: true, //title是必须要传值否则也会报错
    },
  },
}
</script>

<style lang="less" scoped>
.my-header {
  height: 45px;
  line-height: 45px;
  text-align: center;
  background-color: #1d7bff;
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2;
}
</style>
